package net.huashitong.scheduling.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.scheduling.entity.Accounting;
import net.huashitong.scheduling.entity.ProjectRecommendation;
import net.huashitong.scheduling.entity.ProjectSecondRecom;
import net.huashitong.scheduling.filter.ProjectReserveFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class ProjectSecondRecomDao extends StringDao<ProjectSecondRecom> {


    public List<ProjectSecondRecom> queryByType(String type, ProjectReserveFilter filter) {
        GenericQuery query = createQuery("obj");

        query.append(" and obj.month = :month").setParam("month",filter.getMonth());
        query.append(" and obj.year = :year").setParam("year",filter.getYear());

        query.append(" and obj.type = :type order by cast(obj.projectInvestment as int) DESC").setParam("type",type);
      //排序要放最后一行
        return query.listResult();

    }
}
